home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / AppleTalk Wide Area / XTI Shell Sample Code / XTIShellADev.a < prev    next >
Encoding:
Text File  |  1993-02-15  |  9.9 KB  |  324 lines  |  [TEXT/MPS ]

  1. ;_________________________________________________________________________________
  2. ;
  3. ;    File:        adev.a
  4. ;    
  5. ;    Apple Computer, Inc. 
  6. ;    Copyright (C) 1992,1993.  All rights reserved.
  7. ;    
  8. ;    This file contains main entry code for the XTI Shell adev.  A jump table is
  9. ;    used to determine which call is being made, and a C routine is called (in
  10. ;    most cases) to execute the command.
  11. ;    
  12. ;    Revision History:
  13. ;    
  14. ;__________________________________________________________________________________
  15.           BLANKS    ON
  16.  
  17.           TITLE  'XTI adev interface routines'
  18.  
  19.             PRINT        PUSH,OFF
  20.             INCLUDE       'SysEqu.a'                         ; System definitions
  21.             INCLUDE        'HardwareEqu.a'                    ; some hardware stuff
  22.             INCLUDE       'SysErr.a'                         ; System errors
  23.             INCLUDE       'Private.a'                     ; System private definitions
  24.             INCLUDE       'ToolEqu.a'                     ; Toolbox definitions
  25.             INCLUDE        'Traps.a'                        ; Traps definitions
  26.             INCLUDE        'AtalkEqu.a'                    ; Appletalk defs
  27.             PRINT        POP
  28.             INCLUDE        'LAPEqu.a'                        ; LAP manager defs
  29.  
  30.  
  31.             IMPORT        (MGetADEV, MAGetAttribs, MAInit, MAKill):CODE
  32.             IMPORT        (MADraw, MAClick, MAKey):CODE
  33.             IMPORT        (MAActivate, MASelectTE, MAIdle, MAMessage):CODE
  34.             IMPORT        (MAGetConfig, MAGetLine):CODE
  35.             EXPORT        (ADEVCONTROL):CODE
  36.             
  37. GetLine        EQU            $75
  38.  
  39. ResInfo        RECORD        0,DECREMENT                        ; parms for GetResInfo call
  40. theID        DS.W        1
  41. theType        DS.L        1
  42. theName        DS.B        256
  43. Size        DS.B        0
  44.             ENDR
  45.  
  46. ADEVCONTROL    PROC                                        ; D0 = control code
  47.             CMP         #GetADEV,D0                       ; compare to lowest command
  48.             BLT.S         ExitCntrl                          ; Return error if too low
  49.  
  50.             CMP         #GetLine,D0                     ; Make sure not too high
  51.             BGT.S         ExitCntrl                        ; Br if too high
  52. @ProcReq
  53.             SUB            #GetADEV, D0                    ; subtract base from control code
  54.             ADD.W        D0,D0                            ; D0 = D0 * 2;
  55.             MOVE.W        @ControlTable(D0.W),D0            ; Get the routine offset
  56.             JMP            @ControlTable(D0.W)                ; Process the request
  57.                 
  58. @ControlTable
  59.             DC.W        DoGetADEV-@ControlTable            ; get next adev
  60.             DC.W        DoSelectADEV-@ControlTable        ; select adev
  61.             DC.W        DoSelectADEV-@ControlTable        ; re-sel adev
  62.             DC.W        DoMGetADEV-@ControlTable        ; method-based get adev
  63.             DC.W        ExitCntrl-@ControlTable            ; nothing defined
  64.             DC.W        DoGetAttr-@ControlTable            ; get attributes
  65.             DC.W        DoInitADEV-@ControlTable        ; init
  66.             DC.W        DoKillADEV-@ControlTable        ; kill
  67.             DC.W        DoActADEV-@ControlTable            ; do act/inactivate
  68.             DC.W        DoClickADEV-@ControlTable        ; click
  69.             DC.W        DoDrawADEV-@ControlTable        ; draw
  70.             DC.W        DoMsgADEV-@ControlTable            ; message 
  71.             DC.W        DoIdleADEV-@ControlTable        ; idle
  72.             DC.W        DoKeyADEV-@ControlTable            ; key
  73.             DC.W        DoSelTE-@ControlTable            ; selectTE
  74.             DC.W        DoGetConfig-@ControlTable        ; get config
  75.             DC.W        DoGetLine-@ControlTable            ; get a summary line
  76. ExitCntrl            
  77.             RTS
  78.             
  79.  
  80. ;________________________________________________
  81. ;    GetADEV
  82. ;
  83. ;    This call is made by the Network CDEV to all 
  84. ;    adevs.  Since we don't want to be included in 
  85. ;    the control panel because we are not an 
  86. ;    AppleTalk adev, just return an error.
  87. ;
  88. ;    Call:     D1(long) = current value of parameter RAM (3 bytes)
  89. ;            D2(long) = value returned from prev GetADEV or ZERO
  90. ;
  91. ;    Return:    D0(byte) = status flag
  92. ;            D2(long) = value to use for subsequent 
  93. ;                       call (if any) or SelectADEV call
  94. ;            A0->string to describe ICN#(adevBaseID)
  95. ;________________________________________________
  96.  
  97. DoGetADEV                                                
  98.             MOVEQ        #1,D0                            ; no more AppleTalks supported
  99.             CLR.L        D2                                ; illegal value
  100.             LEA            NAstr,A0                        ; A0->"N/A"
  101.             RTS                                            ; return with error
  102.             
  103.             
  104. NAstr        DC.B        3,'N/A'    
  105.             ALIGN        2
  106.                                                                                             
  107. ;________________________________________________
  108. ;    SelectADEV
  109. ;
  110. ;    This routine is called by the Network CDEV
  111. ;    when the adev is selected in the control
  112. ;    panel.  It should NEVER be called, so just
  113. ;    return.
  114. ;
  115. ;    Call:    D2(long) = value returned by GetADEV
  116. ;
  117. ;    Return:    D1(high 3 bytes) = value to set in 
  118. ;            parameter RAM & call ATLK with
  119. ;________________________________________________
  120.  
  121. DoSelectADEV            
  122.             RTS
  123.  
  124. ;________________________________________________
  125. ;    DoMGetADEV
  126. ;
  127. ;    Call:    A0(long) = pointer to ADev record, provided by caller
  128. ;
  129. ;    Return:    A0(long) = ADevRec pointer
  130. ;            D0(byte) = status: 0 for noErr, 1 for no 
  131. ;                       more information, -1 for fatal error
  132. ;________________________________________________
  133.  
  134. DoMGetADEV
  135.             MOVE.L        A0, -(SP)                        ; move adevRec onto stack
  136.             JSR            MGetADEV                        ; returns status in D0
  137.             MOVE.L        (SP)+, A0                        ; restore aRecPtr to A0
  138.             RTS
  139.             
  140.  
  141. ;________________________________________________
  142. ;    DoGetAttr
  143. ;
  144. ;    Call:    A0(long) = pointer to ADev Window record, 
  145. ;                       provided by caller
  146. ;
  147. ;    Return:    A0(long) = ADevWind pointer
  148. ;            D0(byte) = status: 0 for noErr, -1 for 
  149. ;                       insufficient drawing height
  150. ;________________________________________________
  151.  
  152. DoGetAttr
  153.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  154.             JSR            MAGetAttribs                        ; returns status in D0
  155.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  156.             RTS
  157. ;________________________________________________
  158. ;    DoInitADEV
  159. ;
  160. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  161. ;
  162. ;    Return:    A0(long) = ADevWind pointer
  163. ;            D0(byte) = status: 0 for noErr, -1 for 
  164. ;                       initialization err
  165. ;________________________________________________
  166.  
  167. DoInitADEV
  168.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  169.             JSR            MAInit                            ; returns status in D0
  170.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  171.             RTS
  172.  
  173. ;________________________________________________
  174. ;    DoKillADEV
  175. ;
  176. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  177. ;
  178. ;    Return:    A0(long) = ADevWind pointer
  179. ;            D0(byte) = status: 0 for noErr, -1 for 
  180. ;                       can't close at this time
  181. ;________________________________________________
  182.  
  183. DoKillADEV
  184.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  185.             JSR            MAKill                            ; returns status in D0
  186.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  187.             RTS
  188. ;________________________________________________
  189. ;    DoActADEV
  190. ;
  191. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  192. ;
  193. ;    Return:    A0(long) = ADevWind pointer
  194. ;            D0(byte) = status: 0 for noErr, -1 for fatal err
  195. ;________________________________________________
  196.  
  197. DoActADEV
  198.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  199.             JSR            MAActivate                        ; returns status in D0
  200.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  201.             RTS
  202.             
  203. ;________________________________________________
  204. ;    DoClickADEV
  205. ;
  206. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  207. ;
  208. ;    Return:    A0(long) = ADevWind pointer
  209. ;            D0(byte) = status: 0 for noErr, -1 for fatal err
  210. ;________________________________________________
  211.  
  212.  
  213. DoClickADEV
  214.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  215.             JSR            MAClick                            ; returns status in D0
  216.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  217.             RTS
  218.  
  219. ;________________________________________________
  220. ;    DoDrawADEV
  221. ;
  222. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  223. ;
  224. ;    Return:    A0(long) = ADevWind pointer
  225. ;            D0(byte) = status: 0 for noErr, -1 for fatal err
  226. ;________________________________________________
  227.  
  228. DoDrawADEV
  229.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  230.             JSR            MADraw                            ; returns status in D0
  231.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  232.             RTS
  233. ;________________________________________________
  234. ;    DoMsgADEV
  235. ;
  236. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  237. ;
  238. ;    Return:    A0(long) = ADevWind pointer
  239. ;            D0(byte) = status: 0 for noErr, -1 for fatal err
  240. ;________________________________________________
  241.  
  242. DoMsgADEV
  243.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  244.             JSR            MAMessage                            ; returns status in D0
  245.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  246.             RTS
  247.             
  248. ;________________________________________________
  249. ;    DoIdleADEV
  250. ;
  251. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  252. ;
  253. ;    Return:    A0(long) = ADevWind pointer
  254. ;            D0(byte) = status: 0 for noErr, -1 for fatal err
  255. ;________________________________________________
  256.  
  257. DoIdleADEV
  258.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  259.             JSR            MAIdle                            ; returns status in D0
  260.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  261.             RTS
  262.             
  263. ;________________________________________________
  264. ;    DoKeyADEV
  265. ;
  266. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  267. ;
  268. ;    Return:    A0(long) = ADevWind pointer
  269. ;            D0(byte) = status: 0 for noErr, -1 for fatal err
  270. ;________________________________________________
  271.  
  272. DoKeyADEV
  273.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  274.             JSR            MAKey                            ; returns status in D0
  275.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  276.             RTS
  277.             
  278. ;________________________________________________
  279. ;    DoSelTE
  280. ;
  281. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  282. ;
  283. ;    Return:    A0(long) = ADevWind pointer
  284. ;            D0(byte) = status: 0 for noErr, -1 for cannot deactiv current TE field
  285. ;________________________________________________
  286.  
  287. DoSelTE
  288.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  289.             JSR            MASelectTE                            ; returns status in D0
  290.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  291.             RTS
  292.             
  293. ;________________________________________________
  294. ;    DoGetConfig
  295. ;
  296. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  297. ;
  298. ;    Return:    A0(long) = ADevWind pointer
  299. ;            D0(byte) = status: 0 for noErr, -1 for invalid config field data
  300. ;________________________________________________
  301.  
  302. DoGetConfig
  303.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  304.             JSR            MAGetConfig                        ; returns status in D0
  305.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  306.             RTS
  307. ;________________________________________________
  308. ;    DoGetLine
  309. ;
  310. ;    Call:    A0(long) = pointer to ADev Window record, provided by caller
  311. ;
  312. ;    Return:    A0(long) = ADevWind pointer
  313. ;            D0(byte) = status: 0 for noErr, -1 for no more lines
  314. ;________________________________________________
  315.  
  316. DoGetLine
  317.             MOVE.L        A0, -(SP)                        ; move TAdevWindPtr onto stack
  318.             JSR            MAGetLine                        ; returns status in D0
  319.             MOVE.L        (SP)+, A0                        ; clean up the stack & restore A0
  320.             RTS
  321.  
  322.             ENDPROC
  323.             END
  324.